  	var menuWrapper = document.getElementById("menu-wrapper");
  	var menu = document.getElementById("menu");
  	var menuWrapperClassList = menuWrapper.classList;
  	//var backdrop = document.getElementById("menu-backdrop");
  	var request;
  	var city;
  	request = GetRequest();
  	// console.log(request);
  	var busying = false;
  	var ytyJudge = "";
  	var supplier_type = request['supplier_type']; //商铺分类
  	city = request['city'];
  	var price,
  	    page = 1,
  	    posId;


  	// 创建数据模型
  	var postParam = {
  	    supplier_type: supplier_type,
  	    page: page
  	};

  	new Vue({
  	    el: '#list-header',
  	    data: {
  	        ktv: supplier_type
  	    },
  	    methods: {
  	        getContent: function(param) {
  	            var content;
  	            switch (param) {
  	                case '0':
  	                    content = '皇宫';
  	                    break;
  	                case '1':
  	                    content = 'KTV';
  	                    break;
  	                case '2':
  	                    content = '酒吧';
  	                    break;
  	                case '3':
  	                    content = '清吧';
  	                    break;
  	                default:
  	                    content = '其他';
  	                    break;
  	            }
  	            return content;
  	        }
  	    }

  	});

  	function getParam(price, posId) {
  	    if (!!price) {
  	        postParam.per_price = price;
  	    } else {
  	        delete postParam.per_price;
  	    }
  	    if (!!posId) {
  	        postParam.district = posId;
  	    } else {
  	        delete postParam.district;
  	    }
  	    postParam.page = page;
  	    return postParam;

  	}

  	// var url = encodeURI('http://localhost/ypshow/mobile/client_api.php?act=get_supplier_list');
  	var url = encodeURI('http://www.xiaiyepu.cn/mobile/client_api.php?act=get_supplier_list');

  	//初始化部分
  	mui.init({
  	    swipeBack: true,



  	    pullRefresh: {
  	        container: '#yty-pullrefresh',
  	        down: { //加载
  	            //	callback:pulldownRefresh
  	        },
  	        up: { //刷新
  	            contentrefresh: '正在加载...',
  	            contentnomore: '没有更多数据了',
  	            callback: pullupRefresh
  	        }
  	    }



  	});

  	//  获取上个页面数据
  	mui.plusReady(function() {
  	    var self = plus.webview.currentWebview();
  	    supplier_type = self.supplier_type;
  	    city = self.city;
  	});

  	//初始化页面数据
  	function getInitData() {
  	    mui.post(url, {
  	        supplier_type: supplier_type
  	    }, function(data) {
  	        if (data.c & !!data.o) {
  	            addContentMs(data.o);
  	            if (data.e.totalPage <= data.e.currentPage) {
  	                mui('#yty-pullrefresh').pullRefresh().endPullupToRefresh(true);
  	            } else {
  	                page++;
  	                mui('#yty-pullrefresh').pullRefresh().endPullupToRefresh(false);
  	            }
  	        }
  	    });
  	}

  	/*
  	 * 数据部分
  	 */
  	var near = new Vue({
  	    el: '#yty-near',
  	    data: {
  	        items: [
  	            { ytyclass: 'mui-slider-item mui-slider-item-duplicate', ytyimg: '../images/yuantiao.jpg' },
  	            { ytyclass: 'mui-slider-item', ytyimg: '../images/shuijiao.jpg' },
  	            { ytyclass: 'mui-slider-item', ytyimg: '../images/muwu.jpg' },
  	            { ytyclass: 'mui-slider-item', ytyimg: '../images/cbd.jpg' },
  	            { ytyclass: 'mui-slider-item', ytyimg: '../images/yuantiao.jpg' },
  	            { ytyclass: 'mui-slider-item mui-slider-item-duplicate', ytyimg: '../images/shuijiao.jpg' },
  	        ],
  	        ytydivs: [
  	            { divclass: 'mui-indicator mui-active' },
  	            { divclass: 'mui-indicator' },
  	            { divclass: 'mui-indicator' },
  	            { divclass: 'mui-indicator' },
  	        ]
  	    }
  	});

  	// 下拉列表数据模型
  	var menuList = new Vue({
  	    el: '#menu',
  	    data: {
  	        items: {}
  	    }
  	})
  	var ytyList = new Vue({
  	    el: '#yty-pullrefresh',
  	    data: {
  	        ytyCellDatas: []
  	    }
  	});



  	// 多选择－点击获取
  	mui('#yty-btn').on('tap', 'a', function() {
  	    var title = this.getAttribute('title');
  	    // 定义列表显示
  	    if (title == '位置') {
  	        menuList.items = [];
  	        console.log('is position');
  	        // var url = encodeURI('http://localhost/ypshow/mobile/client_api.php?act=find_district&city=' + '珠海'); //测试
  	        var url = encodeURI('http://www.xiaiyepu.cn/mobile/client_api.php?act=find_district&city=' + city);
  	        mui.post(url, function(data) {
  	            //获得服务器响应
  	            if (data.c & !!data.o) {
  	                menuList.items = data.o;
  	            }
  	        }, 'json');
  	    } else {
  	        var newMenuList = [{
  	            doPrice: '1',
  	            region_id: '',
  	            region_name: '0-100'
  	        }, {
  	            doPrice: '1',
  	            region_id: '',
  	            region_name: '100-200'
  	        }];
  	        menuList.items = newMenuList;

  	    }
  	    toggleMenu(title);

  	});

  	//下沉菜单中的点击事件
  	mui('#menu').on('tap', 'a', function() {
  	    var getPrice = this.getAttribute('getPri');
  	    if (getPrice == 1) {
  	        price = this.innerHTML;
  	    } else {
  	        posId = this.getAttribute('getId');
  	    }
  	    toggleMenu("");
  	    // var url = encodeURI('http://localhost/ypshow/mobile/client_api.php?act=get_supplier_list');
  	    var url = encodeURI('http://www.xiaiyepu.cn/mobile/client_api.php?act=get_supplier_list');
  	    mui.post(url, {
  	        supplier_type: supplier_type,
  	        district: posId,
  	        per_price: price,
  	        page: '1'
  	    }, function(data) {
  	        ytyList.ytyCellDatas = [];
  	        if (data.c & !!data.o) {
  	            addContentMs(data.o, 1);
  	        }
  	    });
  	    //i nfo.innerHTML = '你已选择：'+this.innerHTML;
  	});


  	//http://www.xiaiyepu.cn/mobile/client_api.php?act=get_goods_list
  	//列表
  	mui('#yty-pullrefresh').on('tap', 'a', function() {



  	    var ytyhref = 'ye-shop-details.html';
  	    var id = this.getAttribute("ms-id");


  	    var nextUrl = ytyhref + '?supplier_id=' + id;
  	    var extras = {
  	        supplier_id: id
  	    };
  	    console.log('--------???????------', extras.supplier_id);
  	    //  var href = this.getAttribute('href');
  	    var id = ytyhref;
  	    var webview_style = {
  	        popGesture: "close"
  	    }

  	    //非plus环境，直接走href跳转
  	    if (!mui.os.plus) {
  	        // location.href = href;

  	        //方法一
  	        webview = mui.openWindowWithTitle({
  	            url: nextUrl,
  	            id: ytyhref,
  	            extras: extras,
  	        });
  	        return;
  	    }

  	    if (ytyhref && ~ytyhref.indexOf('.html')) {
  	        var webview = plus.webview.create(nextUrl, id, webview_style, extras);
  	        webview.addEventListener('titleUpdate', function() { // titleUpdate 属性名字
  	            setTimeout(function() {
  	                webview.show('pop-in', 300); //效果
  	                //console.log('----efefwaefa',webview.supplier_id);
  	            }, 100);
  	        });
  	    }
  	});




  	/*
  	 *  事件部分
  	 */
  	function toggleMenu(v) {
  	    //menuWrapperClassList.contains('mui-active')
  	    if (v == "") {

  	        closeSelection(v);
  	        busying = false;
  	    }

  	    if (busying == true) { //yes

  	        if (~v.indexOf(ytyJudge)) {
  	            closeSelection(v);
  	        }

  	        if (v != ytyJudge) {
  	            closeSelection(v);
  	            menuWrapper.classList.add('hidden');

  	            setTimeout(function() {

  	                menuWrapper.classList.remove('hidden');
  	                openSelection(v);
  	            }, 50);

  	        }

  	    } else { // no
  	        openSelection(v);
  	    }

  	}
  	// 选择部分代码
  	function openSelection(yty_vlue) {
  	    document.body.classList.add('menu-open');
  	    menuWrapper.className = 'menu-wrapper fade-in-down animated mui-active';
  	    menu.className = 'menu bounce-in-down animated';

  	    if (yty_vlue.indexOf('位置')) {
  	        menuWrapper.classList.add('menu-left-wrapper');
  	    } else {
  	        menuWrapper.classList.add('menu-right-wrapper');
  	    }
  	    setTimeout(function() {
  	        busying = true; // 开启
  	        ytyJudge = yty_vlue;
  	    });
  	};

  	// 关闭部分代码
  	function closeSelection(yty_vlue) {

  	    document.body.classList.remove('menu-open');
  	    if (yty_vlue.indexOf('位置')) {
  	        menuWrapper.className = 'menu-wrapper  menu-left-wrapper fade-out-up animated ';
  	    } else {
  	        menuWrapper.className = 'menu-wrapper  menu-right-wrapper fade-out-up animated';
  	    }
  	    menu.className = 'menu bounce-out-up animated';
  	    setTimeout(function() {
  	        busying = false; //关闭
  	        ytyJudge = "";
  	        menuWrapper.classList.add('hidden');
  	    }, 50);
  	};

  	var count = 0;

  	/**
  	 *  上拉代码
  	 */
  	function pullupRefresh() {
  	    closeSelection(ytyJudge);
  	    var postParam = getParam(price, posId);
  	    mui.post(url, postParam, function(data) {
  	        if (data.c & !!data.o) {
  	            var newContent = [];
  	            for (var i in data.o) {
  	                var content = {
  	                    supplier_id: data.o[i].supplier_id,
  	                    supplier_name: data.o[i].supplier_name,
  	                    per_price: data.o[i].per_price,
  	                    region_name: data.o[i].region_name,
  	                    shop_img: data.o[i].shop_img
  	                }
  	                ytyList.ytyCellDatas.push(content);
  	            }
  	            console.log(newContent)
  	                // ytyList.ytyCellDatas.push(newContent);
  	            page++;
  	            if (data.e.totalPage <= data.e.currentPage) {

  	                mui('#yty-pullrefresh').pullRefresh().endPullupToRefresh(true);
  	            } else {

  	                mui('#yty-pullrefresh').pullRefresh().endPullupToRefresh(false);
  	            }
  	        } else {
  	            mui('#yty-pullrefresh').pullRefresh().endPullupToRefresh(true);
  	        }
  	    });

  	}


  	/*
  	 *   滚动动画 一定要在数据部分前面
  	 */
  	var slider = mui("#yty-near");
  	slider.slider({
  	    interval: 5000
  	});

  	var maxheight = document.documentElement.clientHeight;
  	console.log(maxheight);
  	document.querySelector('#yty-pullrefresh').setAttribute('style', 'height:' + (maxheight - 250) + 'px');

  	//   获取商铺方法
  	function getStore(price, posId) {
  	    var url = encodeURI();
  	    mui.post()
  	}

  	getInitData();

  	function addContentMs(data, doWhat) {
  	    var doWhat = doWhat | 0;
  	    if (doWhat) {
  	        console.log('is' + 1)
  	        ytyList.ytyCellDatas = [];
  	    }
  	    var newContent = [];
  	    for (var i in data) {
  	        var content = {
  	            supplier_id: data[i].supplier_id,
  	            supplier_name: data[i].supplier_name,
  	            per_price: data[i].per_price,
  	            region_name: data[i].region_name,
  	            shop_img: data[i].shop_img
  	        }

  	        ytyList.ytyCellDatas.push(content);
  	    }
  	}

  	// 获取url传参
  	function GetRequest() {
  	    var url = location.search; //获取url中"?"符后的字串   
  	    var theRequest = new Object;
  	    if (url.indexOf("?") != -1) {
  	        var str = url.substr(1);
  	        strs = str.split("&");
  	        for (var i = 0; i < strs.length; i++) {
  	            // theRequest[strs[i].split("=")[0]] = new String(strs[i].split("=")[1].getBytes("iso8859-1"), 'utf-8');
  	            theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
  	            // var strNew = strs[i].split('=')[1];
  	            // str = new String(strNew.getBytes("iso8859-1"), 'utf-8');
  	            // console.log(str)
  	        }
  	        console.log(decodeURIComponent(location.search))
  	    }
  	    return theRequest;
  	}